-
Notifications
You must be signed in to change notification settings - Fork 10
rust testcontainer framework #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is awesome, i'll give a look in the next days! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just left few initial comments, thanks for the contribution!
@slinkydeveloper thanks for the feedback! Just pushed an update that captures the above. Here's the new test implementation: #[tokio::test]
async fn test_container_image() {
let mut test_container = TestContainer::new("docker.io/restatedev/restate", "latest").await.unwrap();
let endpoint = Endpoint::builder()
.bind(MyServiceImpl.serve())
.build();
test_container.serve_endpoint(endpoint).await;
// optionally insert a delays via tokio sleep
TestContainer::delay(1000).await;
// optionally call invoke on service handlers
use restate_sdk::service::Discoverable;
let my_service:Service = ServeMyService::<MyServiceImpl>::discover();
let invoke_response = test_container.invoke(my_service, "my_handler").await;
assert!(invoke_response.is_ok());
println!("invoke response:");
println!("{}", invoke_response.unwrap().text().await.unwrap());
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thanks again for the contribution, I had some time to take a look, it's getting there, I think the API needs another pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome. Run just check
locally to fix linting/formatting issues and then we should be good to go!
thanks again for the recs and sorry for not running lint/fmt! should be good to go now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor nit, and I merge
Here's my initial shot at a testcontainers implementation for the Rust SDK.
I've got the core functionality working, but wanted to share while in progress to see if adding a new "restate-test-utils" crate to the SDK is ok. Also wanted to solicit feedback on ways to extend the test implementation (e.g. mirroring Temporal's approach), per discussions on Discord.
Here's the current test implementation for a service as defined in
tests/test_container.rs